package Modules.MouseCursorModule
{
	import flash.events.MouseEvent;
	import flash.utils.Timer;

	public class Tool
	{	
		
		public var clickTimer:Timer; //Timer for determining if it is a click or a hold
		public var click:Boolean; //Boolean to determine if it is a click or a hold
		public var leftMouseDown:Boolean;
		
		//Constructor
		public function Tool()
		{
			clickTimer = new Timer(1)
			leftMouseDown = false;
			click = false;
		}
		
		//Base function to time and check if it is a click or a drag
		//Specialised functions can be found in the actual tool classes themselves
		public function toolDown(event:MouseEvent):void{
			//Starts a timer to determine if this is a click or a hold
			leftMouseDown = true;
			clickTimer.start();
		}
		
		//Base function to time and check if it is a click or a drag
		//Specialised functions can be found in the actual tool classes themselves
		public function toolUp(event:MouseEvent):void{
			
			//Stops the timer and determine if this is a click or a hold
			clickTimer.stop();
			leftMouseDown = false;
			
			//Time Limit for a click is 10 miliseconds
			if(clickTimer.currentCount <= 10){
				click = true;
			}else{
				click = false;	
			}
			
			//Reset the timer after checking
			clickTimer.reset();
		}
		
		//Basis functions for the specialist tool classes
		public function toolMove(event:MouseEvent):void{
						
		}
		
		public function toolOver(event:MouseEvent):void{
			
		}
		
		public function toolOut(event:MouseEvent):void{
			
		}
	}
}